package com.example.homework_20220930;

import java.util.Scanner;

public class Health {
    int insAmount;
    int age;

    public Health(){
        insAmount = Main.getInfo("Please enter your insurance amount:");
        showInfo();
    }

    protected void showInfo(){
        System.out.println("Please enter the age of the applicant:");
        Scanner sc = new Scanner(System.in);
        age = sc.nextInt();
        if(age >= 20){
            System.out.println("The insurance fee of your property is "
                    + (insAmount / 10000 + (age - 20)*100) + " yuan per year.");
        }else if( age < 20 & age > 0){
            System.out.println("Applicant's age does not conform to the insurance rules! Application denied!");
        }else{
            System.out.println("Wrong input!");
            showInfo();
        }
    }
}
